<?Lassoscript
// Last modified 8/5/11 by ECL, Landmann InterActive

// FUNCTIONALITY
// Setup add functions

// $ACTION VALUES
// The action_param "Action" is passed by the form to indicate whether it is an add or edit
// Possible Actions:
// 		Action = "Update", means the request was an Edit
// 		Action = "Add New Root", means the request was an Add New Root node
// 		Action = "Update Name", means the request was an Update the Name of an existing node
// 		Action = "Delete This Node", means the request was to delete this node and all underlying nodes
// 		Action = "Add New Node", means the request was to add a node in the heirarchy
//				 at ONE LEVEL BELOW the displayed level

// CHANGE NOTES
// 11/23/07
// Recoded for CMS v. 3.0
// 11/29/07
// Moving login check to kill session before navbar is displayed
// 4/30/08
// Added LI_CMSatend at bottom of page to set focus to login box
// 5/20/08
// Recoded URL Links
// 1/15/09
// Added new datatype "Story"
// 6/19/09
// Adding new datatype "Gallery"
// 7/23/09
// Added Robot Check
// 8/5/11
// Added new datatype "Slider"

// Robot check
Include(($svBaseHelpersPath)+'robotcheck.inc');

// Start the Admin session
Session_Start(-Name=$svSessionAdminName, -Expires=$svSessionTimeout);

// Include the Page Intercept
Include(($svAdminHelpersPath)+'page_intercept.inc');

// Convert action_params
Var('vDataType' = Action_Param('DataType'));
Var('vNew' = Action_Param('New'));
Var('vAction' = Action_Param('Action'));

// Page head
Include(($svAdminHelpersPath)+'page_header_admin.inc');

// Debugging
// Var('svDebug' = 'Y');

If($svDebug == 'Y');
	('<p class="debug"><strong>setup_addresponse</strong><br>\n');
	('39: vDataType = '+($vDataType)+'<br>\n');
	('39: vAction = '+($vAction)+'</p>\n');
/If;
?>
<table width="780">
	<tr>
		<td width="170">
			[Include(($svAdminHelpersPath)+'navbar_main.inc')]
		</td>
		<td>
			<div class="contentcontainerwhite">
<?Lassoscript
// Security check
// If privs wrong, display generate error 6004 "Access Restricted" and login form
If((Var('svUserPrivs_Priv') == 'Superadmin') || (Var('svUserPrivs_Priv') == 'Admin'));

	If($vDataType == 'Node');
		Include(($svAdminHelpersPath)+'node_modify.inc');
	Else($vDataType == 'User');
		Include(($svAdminHelpersPath)+'user_addresponse.inc');
		Include(($svAdminHelpersPath)+'show_users.inc');
	Else($vDataType == 'Content');
// NEW
//		Include(($svAdminHelpersPath)+'SessionVarsContent.inc');
		Include(($svAdminHelpersPath)+'content_addresponse.inc');
		Include(($svAdminHelpersPath)+'show_content.inc');
	Else($vDataType == 'Testimonial');
		Include(($svAdminHelpersPath)+'testimonial_addresponse.inc');
		Include(($svAdminHelpersPath)+'show_testimonials.inc');
	Else($vDataType == 'story');
		Include(($svAdminHelpersPath)+'story_addresponse.inc');
		Include(($svAdminHelpersPath)+'show_stories.inc');
	Else($vDataType == 'PortfolioGroup');
		Include(($svAdminHelpersPath)+'portfoliogroup_addresponse.inc');
		Include(($svAdminHelpersPath)+'show_portfoliogroups.inc');
	Else($vDataType == 'PortfolioEntry');
		Include(($svAdminHelpersPath)+'portfolioentry_addresponse.inc');
		Include(($svAdminHelpersPath)+'show_portfolioentries.inc');
	Else($vDataType == 'GalleryGroup');
		Include(($svAdminHelpersPath)+'gallerygroup_addresponse.inc');
		Include(($svAdminHelpersPath)+'show_gallerygroups.inc');
	Else($vDataType == 'GalleryEntry');
		Include(($svAdminHelpersPath)+'galleryentry_addresponse.inc');
		Include(($svAdminHelpersPath)+'show_galleryentries.inc');
	Else($vDataType == 'SliderGroup');
		Include(($svAdminHelpersPath)+'slidergroup_addresponse.inc');
		Include(($svAdminHelpersPath)+'show_slidergroups.inc');
	Else($vDataType == 'SliderEntry');
		Include(($svAdminHelpersPath)+'sliderentry_addresponse.inc');
		Include(($svAdminHelpersPath)+'show_sliderentries.inc');
	Else($vDataType == 'Sys');
		Include(($svAdminViewsPath)+'frm_sys.inc');

	// If wrong parameter passed, end the session, set error to 6004 "Access Restricted" redirect to login
	Else;

		// Session_End(-Name=$svSessionAdminName);
		Var('svUser_ID' = '');
		Var('svUserLoginID' = ''); 
		Var('svUserPrivs_Priv' = '');

		Var('vError' = '6004');
		LI_URLRedirect(-Page=$svLoginPage,-UseError='Y',-Error=$vError);
	/If;

Else;

	// Set error to 6003 "Session Expired", redirect to login
	Var('vError' = '6003');
	LI_URLRedirect(-Page=$svLoginPage,-UseError='Y',-Error=$vError);

/If;
?>
			</div>
		</td>
	</tr>
</table>
[Include(($svBaseHelpersPath)+'build_footer.inc')]
[OutputFooter]
</body>
[LI_CMSatend]
</html>
